﻿using IntelligentGateway.Data;
using IntelligentGateway.Model;
using IntelligentGateway.Services;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace IntelligentGateway.Controllers.api
{
    [Route("api/[controller]")]
    [ApiController]
    public class MasterDeviceInfoController : ControllerBase
    {
        [HttpPost]
        [Route("Delete")]
        public ResponseMessage Delete(MasterDeviceInfo t)
        {
            DaServices<MasterDeviceInfo> services = new DaServices<MasterDeviceInfo>();
            return services.Delete(t);
        }
        [HttpPost]
        [Route("Insert")]
        public ResponseMessage Insert(MasterDeviceInfo t)
        {
            DaServices<MasterDeviceInfo> services = new DaServices<MasterDeviceInfo>();
            return services.Insert(t);
        }
        [HttpPost]
        [Route("SelectAllByFilter")]
        public ResponseMessage SelectAllByFilter(MasterDeviceInfo t, int startindex, int endindex)
        {
            DaServices<MasterDeviceInfo> services = new DaServices<MasterDeviceInfo>();
            return services.SelectAllByFilter(t, startindex, endindex);
        }
        [HttpPost]
        [Route("SelectAllData")]
        public ResponseMessage SelectAllData()
        {
            DaServices<MasterDeviceInfo> services = new DaServices<MasterDeviceInfo>();
            return services.SelectAllData();
        }
        [HttpPost]
        [Route("SelectByFilter")]
        public ResponseMessage SelectByFilter(MasterDeviceInfo t)
        {
            DaServices<MasterDeviceInfo> services = new DaServices<MasterDeviceInfo>();
            return services.SelectByFilter(t);
        }
        [HttpPost]
        [Route("SelectByKey")]
        public ResponseMessage SelectByKey(int Key)
        {
            DaServices<MasterDeviceInfo> services = new DaServices<MasterDeviceInfo>();
            return services.SelectByKey(Key);
        }
        [HttpPost]
        [Route("Update")]
        public ResponseMessage Update(MasterDeviceInfo t)
        {
            DaServices<MasterDeviceInfo> services = new DaServices<MasterDeviceInfo>();
            return services.Update(t);
        }
        [HttpPost]
        [Route("GetAllDevices")]
        public ResponseMessage GetAllDevices()
        {
            ResponseMessage response = new ResponseMessage();
            response.data = GlobalVariables.DeviceList;
            return response;
        }

        [HttpPost]
        [Route("GetSignPointType")]
        public ResponseMessage GetSignPointType()
        {
            ResponseMessage response = new ResponseMessage();
            SignalPointDA signalPointDA = new SignalPointDA();
            List<SignalPoint> list = signalPointDA.GetAllPointType();
            response.data = list;
            return response;
        }
    }
}
